package com.itheima.netmarket.impl.view.manager;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;

import com.itheima.netmarket.formwork.view.manager.BottomManager;
import com.itheima.netmarket.impl.view.ShoppingCart;

import comitheima.netmarket.R;

/**
 * 
 * @author 武嘉豪
 * 
 */
public class BottomManagerImpl implements BottomManager {
	private Activity activity;
	private static final BottomManager bottomManager = new BottomManagerImpl();
	private ImageView imgHome;
	private ImageView imgClassify;
	private ImageView imgSearch;
	private ImageView imgShoppingCar;
	private ImageView imgMore;

	private BottomManagerImpl() {

	}

	public static BottomManager getInstance() {
		return bottomManager;
	}

	public void init(Activity activity) {
		this.activity = activity;
		imgHome = (ImageView) activity.findViewById(R.id.imgHome);
		imgClassify = (ImageView) activity.findViewById(R.id.imgClassify);
		imgSearch = (ImageView) activity.findViewById(R.id.imgSearch);
		imgShoppingCar = (ImageView) activity.findViewById(R.id.imgShoppingCar);
		imgMore = (ImageView) activity.findViewById(R.id.imgMore);
		/*****************************************************************/
		imgHome.setOnClickListener(this);
		imgClassify.setOnClickListener(this);
		imgSearch.setOnClickListener(this);
		imgShoppingCar.setOnClickListener(this);
		imgMore.setOnClickListener(this);
	}

	@Override
	public void changeView(int num) {

	}

	@Override
	public void onClick(View v) {
		/*
		 * imgHome.setOnClickListener(this);
		 * imgClassify.setOnClickListener(this);
		 * imgSearch.setOnClickListener(this);
		 * imgShoppingCar.setOnClickListener(this);
		 * imgMore.setOnClickListener(this);
		 */
		switch (v.getId()) {
		case R.id.imgHome:
			break;
		case R.id.imgClassify:
			break;
		case R.id.imgSearch:
			break;
		case R.id.imgShoppingCar:
			UIManagerImpl.getInstance().changeView(ShoppingCart.class);
			System.out.println("onclick");
			break;
		case R.id.imgMore:
			break;
		}
	}

}
